﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using System.Web.Http.SelfHost;

namespace MyConsoleWebApi
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Title = "Api Service";

            var config = new HttpSelfHostConfiguration("http://localhost:8801");
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional });
            using (var svr = new HttpSelfHostServer(config))
            {
                svr.OpenAsync().Wait();
                Console.WriteLine("Web API service start.....");
                Console.ReadLine();
            }
        }
    }
}